package TiAnGo;

import java.util.Random;

/**
 * @Author czl
 * @Date 2024-03-22
 */
public class Fruit {
    private String []  array={"苹果","西瓜","哈密瓜","雪梨","榴莲","车厘子","山竹"};

    private int index;

    public Fruit(){
        this.index=new Random().nextInt(this.array.length);
    }

    public String toString(){
        return  this.array[this.index];
    }

    public static void main(String[] args) {
        Fruit f = new Fruit();

        System.out.println(f);
    }
}
